package com.wht.media.controller;


import com.wht.media.common.R;
import com.wht.media.config.MediaServerConfig;
import com.wht.media.model.param.TestVideoParam;
import com.wht.media.model.result.StreamUrlResult;
import com.wht.media.model.test.TestVideo;
import org.noear.solon.annotation.*;
import org.noear.solon.validation.annotation.Validated;

/**
 * 测试接口
 *
 * @author by HaiTao.Wang on 2025/9/12.
 */
@Controller
@Mapping("test")
public class TestController {

    @Inject
    MediaServerConfig config;

    /**
     * 生成一路测试视频流
     *
     * @return
     */
    @Post
    @Mapping("createTestVideo")
    public R createTestVideo(@Validated @Body TestVideoParam param) {

        TestVideo testVideo = new TestVideo(param);
        testVideo.initVideo();
        testVideo.startTestVideo();
        return R.data(new StreamUrlResult(config, param));
    }
}
